package org.foreveross.que.applicationImpl;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;




import org.foreveross.que.entity.RoleMenuREntity;
import org.foreveross.que.infra.RoleMenuRRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.foreveross.que.application.RoleMenuRApplication;
@Service
public class RoleMenuRApplicationImpl implements RoleMenuRApplication {

	@Autowired RoleMenuRRepository repository;
	
	@Override
	public List<String> getRoleMenus(Set<String> roles,String sysType){
		if(roles==null||roles.size()==0){
			return null;
		}
		
		List<RoleMenuREntity> rmus = repository.findByRole(roles.toArray(), sysType);
		if(rmus==null||rmus.size()==0){
			return null;
		}
		List<String> result = new ArrayList<String>();
		for(RoleMenuREntity r :rmus){
			result.add(r.getMid());
		}
		return result;
	}
	
}
